import { request } from '@/utils/request';
// import type { BaseResponse } from '@/utils/request';
import Api from '@/core/permission/modules/model/attribute';

export function getAttributeInfo(query: { id: string }) {
  return request<API.AttributeInfoResult>({
    url: Api.info,
    method: 'get',
    params: query,
  });
}

export function getAttributeList(query?: API.PageParams) {
  return request<API.AttributeListResult>({
    url: Api.list,
    method: 'get',
    params: query,
  });
}

export function createAttribute(data: API.CreateAttributeParams) {
  return request(
    {
      url: Api.add,
      method: 'post',
      data,
    },
    {
      successMsg: '创建模型属性成功',
    },
  );
}

export function editAttribute(data: API.UpdateAttributeParams) {
  return request(
    {
      url: Api.edit,
      method: 'post',
      data,
    },
    {
      successMsg: '更新模型属性成功',
    },
  );
}

export function deleteAttribute(data: string[]) {
  return request(
    {
      url: Api.delete,
      method: 'delete',
      data,
    },
    {
      successMsg: '删除模型属性成功',
    },
  );
}
